import React, { Component } from 'react'
import PubSub from 'pubsub-js'

export default class Subscribe extends Component {
    publish = () => {
        PubSub.publish( "My Topic", "hello react" )
    }
    render() {
        
        return (
            <div>
                Subscribe
                <button onClick={ this.publish }>发布</button>
            </div> 
        )
    }
}
